import { fromJS } from 'immutable'
import * as types from './action-types'

const defaultState = fromJS({
  bodySize: {},
  userInfo: null
})

export default (state = defaultState, action) => {
  switch (action.type) {
    case types['CHANGE_USERINFO']:
      return state.set('userInfo', fromJS(action.data))
    case types['CHANGE_BODYSIZE']:
      return state.set('bodySize', fromJS(action.size))
    default:
      return state
  }
}
